#include<iostream>
#include<vector>
#include<ranges>
#include<unordered_map>
using namespace std;

class Solution {
public:
    vector<int> relocateMarbles(vector<int>& nums, vector<int>& moveFrom, vector<int>& moveTo)
    {
        unordered_map<int, int> hash;
        for (int i = 0; i < nums.size(); i++)
        {
            if (hash[nums[i]])
                continue;
            hash[nums[i]]++;
        }
        for (int i = 0; i < moveFrom.size(); i++)
        {
            hash[moveFrom[i]]--;
            if (hash[moveTo[i]])
                continue;
            hash[moveTo[i]]++;
        }
        vector<int> ans;
        for (auto& [x, y] : hash)
        {
            if (y > 0)
                ans.push_back(x);
        }
        ranges::sort(ans);
        return ans;
    }
};